package com.tanggh.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import com.tanggh.dao.GenericDao;
import com.tanggh.dao.UserDao;
import com.tanggh.entity.User;
import com.tanggh.service.UserService;

@Service
public class UserServiceImpl extends GenericServiceImpl<User> implements UserService {
	
	private UserDao userDao;
	
	@Autowired
	@Qualifier("userDaoImpl")
	@Override
	protected void setGenericDao(GenericDao<User> genericDao) {
		this.genericDao = genericDao;
		this.userDao = (UserDao) genericDao;
	}

	@Override
	public boolean checkEmailExist(String email) {
		Integer count = userDao.checkEmailExist(email);
		return count == 0 ? false : true;
	}
	
	@Override
	public User findUser(User user) {
		return userDao.findUser(user);
	}
}
